package com.xiaoyung.easyisapisdk.feign.api.workflow;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.xiaoyung.easyisapisdk.common.base.Rest;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheDeleteParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheExpireParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheGetHashMapParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheGetMultiHashMapParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheKeyParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheListParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheLockParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheLockReleaseParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheMapParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CachePatternParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheSetHashMapParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheSetObjectParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheSetParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheZsetIncrementParam;
import com.xiaoyung.easyisapisdk.common.workflow.request.cache.CacheZsetRangeParam;

import feign.Headers;
import feign.RequestLine;

//@Api(tags = { "redis缓存服务" })
//@ApiSupport(author = "Martin", order = 2)
//@RestController
//@RequestMapping(value = "/serviceapi/cache")
public interface CacheApi {

	/**
	 * 缓存基本的对象，Integer、String、实体类等
	 */
//	@PostMapping(value = "/serviceapi/cache/setCacheObject", name = "缓存对象")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/setCacheObject")
	public Void setCacheObject(CacheSetObjectParam req);
	
	/**
	 * 设置有效时间
	 */
//	@PostMapping(value = "/serviceapi/cache/expire", name = "设置有效时间")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/expire")
	public Boolean expire(CacheExpireParam req);
	
	/**
	 * 判断 key是否存在
	 */
//	@PostMapping(value = "/serviceapi/cache/hasKey", name = "判断 key是否存在")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/hasKey")
	public Boolean hasKey(CacheKeyParam req);
	
	/**
	 * 获得缓存的基本对象
	 */
//	@PostMapping(value = "/serviceapi/cache/getCacheObject", name = "获得缓存的基本对象")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getCacheObject")
	public Object getCacheObject(CacheKeyParam req);
	
	/**
	 * 删除单个或集合对象 传入参数key为string时删除单个对象，为collection时删除集合对象
	 */
//	@PostMapping(value = "/serviceapi/cache/deleteObject", name = "删除单个或集合对象")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/deleteObject")
	public Object deleteObject(CacheDeleteParam req);
	
	/**
	 * 根据pattern删除
	 */
//	@PostMapping(value = "/serviceapi/cache/deleteByPattern", name = "根据pattern删除")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/deleteByPattern")
	public Long deleteByPattern(CachePatternParam req);
	
	/**
	 * 缓存List数据
	 */
//	@PostMapping(value = "/serviceapi/cache/setCacheList", name = "缓存List数据")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/setCacheList")
	public Long setCacheList(CacheListParam req);

	/**
	 * 获得缓存的list对象
	 */
//	@PostMapping(value = "/serviceapi/cache/getCacheList", name = "获得缓存的list对象")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getCacheList")
	public List<Object> getCacheList(CacheKeyParam req);

	/**
	 * 缓存Set
	 */
//	@PostMapping(value = "/serviceapi/cache/setCacheSet", name = "缓存Set")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/setCacheSet")
	public Rest<Void> setCacheSet(CacheSetParam req);

	/**
	 * 获得缓存的set
	 */
//	@PostMapping(value = "/serviceapi/cache/getCacheSet", name = "获得缓存的set")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getCacheSet")
	public Set<Object> getCacheSet(CacheKeyParam req);

	/**
	 * 缓存Map
	 */
//	@PostMapping(value = "/serviceapi/cache/setCacheMap", name = "缓存Map")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/setCacheMap")
	public Rest<Void> setCacheMap(CacheMapParam req);

	/**
	 * 获得缓存的Map
	 */
//	@PostMapping(value = "/serviceapi/cache/getCacheMap", name = "获得缓存的Map")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getCacheMap")
	public Map<String, Object> getCacheMap(CacheKeyParam req);

	/**
	 * 往Hash中存入数据
	 */
//	@PostMapping(value = "/serviceapi/cache/setCacheMapValue", name = "往Hash中存入数据")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/setCacheMapValue")
	public Void setCacheMapValue(CacheSetHashMapParam req);

	/**
	 * 获取Hash中的数据
	 */
//	@PostMapping(value = "/serviceapi/cache/getCacheMapValue", name = "获取Hash中的数据")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getCacheMapValue")
	public Object getCacheMapValue(CacheGetHashMapParam req);

	/**
	 * 获取多个Hash中的数据
	 */
//	@PostMapping(value = "/serviceapi/cache/getMultiCacheMapValue", name = "获取多个Hash中的数据")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/getMultiCacheMapValue")
	public Object getMultiCacheMapValue(CacheGetMultiHashMapParam req);

	/**
	 * 获得缓存的基本对象列表
	 */
//	@PostMapping(value = "/serviceapi/cache/keys", name = "获得缓存的基本对象列表")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/keys")
	public Collection<String> keys(CachePatternParam req);

	/**
	 * zsetIncrementScore
	 */
//	@PostMapping(value = "/serviceapi/cache/zsetIncrementScore", name = "增加value分数")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/zsetIncrementScore")
	public Double zsetIncrementScore(CacheZsetIncrementParam req);

	/**
	 * 根据key 查询 zset 成员数量
	 */
//	@PostMapping(value = "/serviceapi/cache/zsetZCard", name = "根据key 查询 zset 成员数量")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/zsetZCard")
	public Long zsetZCard(CacheKeyParam req);

	/**
	 * 返回zset中的成员 根据startIndex ,endIndex 
	 */
//	@PostMapping(value = "/serviceapi/cache/zsetRange", name = "返回zset中的成员 根据startIndex ,endIndex ")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/zsetRange")
	public Set<Object> zsetRange(CacheZsetRangeParam req);

	/**
	 * 根据index 范围删除zset 成员
	 */
//	@PostMapping(value = "/serviceapi/cache/zsetRemoveRange", name = "根据index 范围删除zset 成员")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/zsetRemoveRange")
	public Long zsetRemoveRange(CacheZsetRangeParam req);

	/**
	 * 加锁
	 */
//	@PostMapping(value = "/serviceapi/cache/lockWithTimeout", name = "加锁")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/lockWithTimeout")
	public String lockWithTimeout(CacheLockParam req);

	/**
	 * 释放锁
	 */
//	@PostMapping(value = "/serviceapi/cache/releaseLock", name = "释放锁")
	@Headers("Content-Type: application/json")
	@RequestLine("POST /openapi/workflow/cache/releaseLock")
	public Boolean releaseLock(CacheLockReleaseParam req);
	
}
